package cardwall.server;

import cardwall.shared.Task;
import simpleorm.dataset.*;

public class STask extends SRecordInstance implements Task {

	public static final SRecordMeta<STask> TASK = new SRecordMeta<STask>(STask.class, "TASK");

	public static final SFieldInteger ID
        = new SFieldInteger(TASK, "ID", SFieldFlags.SPRIMARY_KEY).setGeneratorMode(SGeneratorMode.SSELECT_MAX, "task_seq");

	public static final SFieldString NAME 
        = new SFieldString(TASK, "NAME", 40, SFieldFlags.SMANDATORY, SFieldFlags.SDESCRIPTIVE);

	public static final SFieldString DESCRIPTION
     	= new SFieldString(TASK, "DESCRIPTION", 200, SFieldFlags.SMANDATORY, SFieldFlags.SDESCRIPTIVE);

    public static final SFieldInteger TOP
        = new SFieldInteger(TASK, "TOP", SFieldFlags.SMANDATORY);

    public static final SFieldInteger LEFT
        = new SFieldInteger(TASK, "LEFT", SFieldFlags.SMANDATORY);

    public @Override() SRecordMeta<STask> getMeta() {
		return TASK;
	}

    public String getName() {
        return getString(NAME);
    }

    public Task setName(String value) {
        setString(NAME, value);
        return this;
    }

    public String getDescription() {
        return getString(DESCRIPTION);
    }

    public Task setDescription(String value) {
        setString(DESCRIPTION, value);
        return this;
    }

    public int getId() {
        return getInt(ID);
    }

    public Task setId(int value) {
        setInt(ID, value);
        return this;
    }

    public int getLeft() {
        return getInt(LEFT);
    }

    public Task setLeft(int value) {
        setInt(LEFT, value);
        return this;
    }

    public int getTop() {
        return getInt(TOP);
    }

    public Task setTop(int value) {
        setInt(TOP, value);
        return this;
    }

    public void update(Task task) {
        setName(task.getName());
        setDescription(task.getDescription());
        setLeft(task.getLeft());
        setTop(task.getTop());
    }
}
